<%--
  Created by IntelliJ IDEA.
  User: HUAWEI
  Date: 2023/9/15
  Time: 17:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>个人考勤信息</title>
    <script src="../static/js/vue.js"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">

    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="../static/js/jquery-3.2.1.min.js"></script>
    <script src="../static/js/Core_values.js"></script>

    <style>
        .el-pagination {
            text-align: right;
            margin-top: 20px;
        }

        .el-input {
            width: 200px;
        }


    </style>
</head>
<body>
<script src="../static/js/flower.js"></script>

<div id="tab" style="height: 100%">
    <div class="demo-input-size">
        <el-input type="date" v-model="clockDate" placeholder="日期">
        </el-input>
        <el-button type="primary" @click="search()" icon="el-icon-search">搜索</el-button>
    </div>
    <el-table
            :data="tableData"
            border
            style="width: 100%"
    <%--            @selection-change="selectChange"--%>
    >
        <el-table-column
                prop="userName"
                label="姓名"
                width="120">
        </el-table-column>
        <el-table-column
                prop="clockDate"
                label="日期"
                width="200">
        </el-table-column>
        <el-table-column
                prop="mornSignIn"
                label="早上上班打卡情况"
                width="160">
        </el-table-column>
        <el-table-column
                prop="mornSignOut"
                label="中午下班打卡情况"
                width="160">
        </el-table-column>
        <el-table-column
                prop="afterSignIn"
                label="中午上班打卡情况"
                width="160">
        </el-table-column>
        <el-table-column
                prop="afterSignOut"
                label="下午下班打卡情况"
                width="160">
        </el-table-column>
    </el-table>
</div>
</body>
<script>
    new Vue({
        el:"#tab",
        data:{
            tableData:[],
            userName:JSON.parse(localStorage.getItem("userName")),
            clockDate:"",
            clockId:""
        },
        methods:{
            loadUserSelf(){
                // console.log(this.userName)
                var v=this
                $.ajax({
                    url:"../api/attendanceSelf",
                    type:"post",
                    dataType:"json",
                    data: {"userName":v.userName,"clockDate":v.clockDate},
                    success:function (res) {
                        // console.log(res)
                        if (res.status==200){
                            v.tableData=res.object
                            // v.totals=res.object.totals
                        }
                    },
                    error:function () {
                        v.$message.error("服务器出错！")
                    }
                })
            },
            search(){
                this.loadUserSelf()
            },
        },
        mounted(){
            // this.userName=sessionStorage.getItem('loginUsername')
            this.loadUserSelf();
        }
    })
</script>
</html>
